package com.qian.apiserver.controller;

import com.qian.apiserver.model.Warn;
import com.qian.apiserver.service.IWarnService;
import com.yaowk.api.common.PageReq;
import com.yaowk.api.common.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
//已完成
@RestController
@RequestMapping("/game/prompt")
@Api(tags = "提示功能")
public class WarnController {
    @Autowired
    private IWarnService warnService;

    @GetMapping("/all")
    @ApiOperation("列表")
    private PageResp<Warn> findAll(PageReq pageReq){
        return warnService.findAll(pageReq);
    }

    @PostMapping("/save")
    @ApiOperation("保存")
    private void save(Warn warn){
        warnService.save(warn);
    }

    @GetMapping("/delete/{id}")
    @ApiOperation("删除")
    private void delete(@PathVariable Integer id){
        warnService.deleteById(id);
    }

    @GetMapping("/query")
    @ApiOperation("类型查询")
    private PageResp<Warn> query(Warn warn,PageReq pageReq){
        return warnService.find(warn,pageReq);
    }
}
